package top.market.redis;

import org.redisson.api.RBloomFilter;
import org.redisson.api.RedissonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

@Configuration
public class LyhRedissBloomFilerConfig {

    @Resource
    private RedissonClient redissonClient;

    @Bean
    public RBloomFilter<String> bloomFilter(){
        RBloomFilter<String> bloomFilter = redissonClient.getBloomFilter("bloomtest");
        bloomFilter.tryInit((long) 1E8,0.003); // 精度越高，消耗空间越大
        return bloomFilter;
    }
}